#include "gwbase/base/hash.h"

#include "gwbase/base/logging.h"

namespace dicom {

// see http://en.wikipedia.org/wiki/Jenkins_hash_function
uint32_t hash(const void* data, size_t len) {
  const unsigned char* key = static_cast<const unsigned char*>(data);
  uint32_t hash, i;
  for (hash = i = 0; i < len; ++i) {
    hash += key[i];
    hash += (hash << 10);
    hash ^= (hash >> 6);
  }
  hash += (hash << 3);
  hash ^= (hash >> 11);
  hash += (hash << 15);
  return hash;
}
}
